﻿#include<iostream>
using namespace std;
#include "student.h"
#include "fun_achieve.h"
void showMenu();

int main()
{
	int num;
	vector<Student> v;
	while (true)
	{
		FunAchieve stu;
		showMenu();
		cout << "\n\n请输入对应的功能序号：";
		cin >> num;
		cout << "\n\n";
		switch (num)
		{
		case 1:
			stu.ShowAllMessage(v);
			break;
		case 2:
			stu.AddMessage(v);
			break;
		case 3:
			stu.RemoveMessage(v);
			break;
		case 4:
			stu.SearchMessage(v);
			break;
		case 5:
			stu.UpdateMessage(v);
			break;
		case 6:
			stu.SortMessage(v);
			break;
		case 7:
			stu.AnalyMessage(v);
			break;
		case 8:
			stu.ClearMessage(v);
			break;
		case 9:
			stu.InputFile(v);
			break;
		case 10:
			stu.OutputFile(v);
			break;
		case 0:
			cout << "\n\n################感谢您的使用，让编程成为一种习惯！################\n\n" << endl;
			float y, x, z, f;
			for (y = 1.5f; y > -1.5f; y -= 0.1f)
			{
				for (x = -1.5f; x < 1.5f; x += 0.05f)
				{
					z = x * x + y * y - 1;
					f = z * z * z - x * x * y * y * y;
					cout.put(f <= 0.0f ? "*********"[(int)(f * -8.0f)] : ' ');
				}
				cout << '\n';
			}
			return 0;
		default:
			cout << "\n\n################序号有误，请重新输入！################\n\n" << endl;
			break;
		}
	}
	return 0;
}

void showMenu()
{
	cout << "************欢迎使用学生成绩管理系统************\n\n";
	cout << "                                           制作人:xxx\n\n";
	cout << "========================================================\n";
	cout << "*                  1.显示所有学生信息                  *\n";
	cout << "*                  2.录入学生信息                      *\n";
	cout << "*                  3.删除学生信息                      *\n";
	cout << "*                  4.查询学生信息                      *\n";
	cout << "*                  5.修改学生信息                      *\n";
	cout << "*                  6.对学生信息进行排序                *\n";
	cout << "*                  7.成绩统计分析                      *\n";
	cout << "*                  8.清空学生信息                      *\n";
	cout << "*                  9.从文本文件读入                    *\n";
	cout << "*                 10.保存到文本文件                    *\n";
	cout << "*                  0.退出系统                          *\n";
	cout << "========================================================" << endl;
}